<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <title>测一测孩子的5种思维力</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="full-screen" content="true" />
    <meta name="screen-orientation" content="portrait" />
    <meta name="x5-fullscreen" content="true" />
    <meta name="360-fullscreen" content="true" />
    <script src="//cdn.jsdelivr.net/npm/eruda"></script>
    <script>eruda.init();</script>
    <script src="https://xcx.mifengshuxue.com/question/assets/v1/jquery.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script>
        window.AVATOR = '';
        window.GLOBAL_MUSIC = '';
        window.GLOBAL_CHANNEL = '';
        window.GLOBAL_IMAGE = '';
        window.GLOBAL_PATH = 'https://xcx.mifengshuxue.com';
        window.USER_ID = '';
        window.HAS_OLD_SCORE = false;
        window.SCORE = {
            math: 0,    //数感
            illation: 0,    //推理
            observation: 0, //观察
            space: 0,   //空间感
            memory: 0   //记忆力
        };
        window.CANREAD = false;
        window.QSID = '';
        window.SHOWRESULT = function() {
            $.ajax({
                url: GLOBAL_PATH + '/question/report/operate',
                method:'POST',
                headers: {
                    'Content-Type': "application/json;charset=UTF-8"
                },
                data: JSON.stringify({userId: USER_ID, reportId: QSID, operateType: 2}),
                success:(res) => {
                    if(JSON.parse(res).success){
                        CANREAD = true;
                    }
                }
            })
        }

        function getQueryString(name) { 
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
            var r = window.location.search.substr(1).match(reg); 
            if (r != null) return unescape(r[2]); 
            return null; 
        } 

        if(!getQueryString('code')){
            // window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxeac125aaacee378d&redirect_uri=https%3A%2F%2Fxcx.mifengshuxue.com%2Fquestion%2Fassets%2Fv1%2Findex.html&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
        }
    </script>
    <style>
        html, body {
            -ms-touch-action: none;
            background: #888888;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
        .result-btn,.result-btn2{
            position: absolute;
            bottom:0;
            text-align: center;
            width:100%;
            z-index: 99;
            display:none;
        }
        .result-btn{
            top:0;
            right:0;
            left:0;
            margin:auto;
            height:90px;
        }
        .shareBg{
            position: absolute;
            top:0;
            left:0;
            width:100%;
            height:100%;
            z-index: 100;
            display:none;
            background-color: rgba(76,76,76,0.7);
        }
        .last{
            position: absolute;
            top:0;
            left:0;
            width:100%;
            height:100%;
            z-index: 100;
            display:none;
            background-color: rgba(76,76,76,0.7);
        }
        .arrow{
            position:absolute;
            width:50px;
            height:91px;
            top:20px;
            right:70px;
        }
        .shareText{
            position:absolute;
            top:130px;
            color:white;
            left:0;
            right:0;
            margin:0 auto;
            text-align: center;
            width:150px;
            height:60px;
            background: url('resource/image/shareBg.png');
            background-size: contain;
            background-repeat: no-repeat;
            padding: 30px 20px;
        }
        .shareCancel{
            position:absolute;
            width:130px;
            height:40px;
            border-radius:10px;
            background:#ff5500;
            color:white;
            text-align: center;
            line-height: 40px;
            top:300px;
            left:0;
            right:0;
            margin:0 auto;
        }
        .loading-shadow{
            width:100%;
            height:100%;
            position: absolute;
            top:0;
            left:0;
            background-color:black;
        }
        .loading{
            width:120px;
            right: 0;
            left:0;
            top:0;
            bottom:0;
            margin: auto;
            position: absolute;
            height:250px;
        }
        .loading-img{
            width:120px;
        }
        .loading-bar{
            width:0;
            height:2px;
            background-color:white;
            border:1px solid white;
        }
        .last1{
            width:300px;
        }
        .last2{
            width:50px;
            margin-top:20px;
        }
        .last>div{
            width:300px;
            height:300px;
            left:0;
            right:0;
            top:0;
            bottom:0;
            margin: auto;
            position: absolute;
            text-align: center;
            margin-top:100px;
        }
    </style>
</head>

<body>
    <div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
         data-entry-class="Main"
         data-orientation="auto"
         data-scale-mode="fixedWidth"
         data-frame-rate="30"
         data-content-width="640"
         data-content-height="1136"
         data-multi-fingered="2"
         data-show-fps="false" data-show-log="false"
         data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
    </div>
    <div id="gameDiv"></div>
    <div class="result-btn">
        <img class="payBtn" src="resource/image/result1.png" style="width: 300px;margin-bottom:20px;" alt="">
        <img class="shareBtn" src="resource/image/result2.png" style="width: 300px" alt="">
    </div>
    <div class="result-btn2">
        <img class="payBtn2" src="resource/image/result4.png" style="width: 300px" alt="">
    </div>
    <div class="shareBg">
        <img src="resource/image/arrow.png" class="arrow">
        <div class="shareText">
            点击右上角分享到好友或分享到朋友圈
        </div>
        <div class="shareCancel">知道了</div>
    </div>
    <div class="loading-shadow">

    </div>
    <div class="loading">
        <img class="loading-img" src="resource/image/loading.png">
        <div class="loading-bar"></div>
    </div>
    <div class="last">
        <div>
            <img src="resource/image/last1.png" class="last1">
            </br>
            <img src="resource/image/last2.png" class="last2">
        </div>
    </div>
<script>
    $('.shareBg').on('click',function() {
        $(this).hide()
    })
    $('.last2').on('click',function() {
        $('.last').hide()
    })
    function translatePx(num) {
        return Math.ceil(num * 1.7);
    }
    function translatePxS(num) {
        return Math.ceil(num * 1.44);
    }
    var loadScript = function (list, callback) {
        var loaded = 0;
        var loadNext = function () {
            loadSingleScript(list[loaded], function () {
                loaded++;
                if (loaded >= list.length) {
                    callback();
                }
                else {
                    loadNext();
                }
            })
        };
        loadNext();
    };

    var loadSingleScript = function (src, callback) {
        var s = document.createElement('script');
        s.async = false;
        s.src = src;
        s.addEventListener('load', function () {
            s.parentNode.removeChild(s);
            s.removeEventListener('load', arguments.callee, false);
            callback();
        }, false);
        document.body.appendChild(s);
    };

    var xhr = new XMLHttpRequest();
    xhr.open('GET', './manifest.json?v=' + Math.random(), true);
    xhr.addEventListener("load", function () {
        var manifest = JSON.parse(xhr.response);
        var list = manifest.initial.concat(manifest.game);
        loadScript(list, function () {
            /**
             * {
             * "renderMode":, //Engine rendering mode, "canvas" or "webgl"
             * "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
             * "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
             * "calculateCanvasScaleFactor": //a function return canvas scale factor
             * }
             **/
            egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
                var backingStore = context.backingStorePixelRatio ||
                    context.webkitBackingStorePixelRatio ||
                    context.mozBackingStorePixelRatio ||
                    context.msBackingStorePixelRatio ||
                    context.oBackingStorePixelRatio ||
                    context.backingStorePixelRatio || 1;
                return (window.devicePixelRatio || 1) / backingStore;
            }});
        });
    });
    xhr.send(null);
</script>
</body>

</html>